package com.wechat.entity;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Data;

/**
 * 回复用户消息实体
 */
@Data
@JacksonXmlRootElement(localName = "xml")
public class WxMessageRsp {

    @JacksonXmlProperty(localName = "ToUserName")
    private String toUserName;

    @JacksonXmlProperty(localName = "FromUserName")
    private String fromUserName;

    @JacksonXmlProperty(localName = "CreateTime")
    private long createTime;

    @JacksonXmlProperty(localName = "MsgType")
    private String msgType;

    /**
     * 文本消息
     */
    @JacksonXmlProperty(localName = "Content")
    private String content;

    /**
     * 图片消息
     */
    @JacksonXmlProperty(localName = "Image")
    private Image image;

    /**
     * 语音消息
     */
    @JacksonXmlProperty(localName = "Voice")
    private Voice voice;

    /**
     * 视频消息
     */
    @JacksonXmlProperty(localName = "Video")
    private Video video;

    @Data
    @JacksonXmlRootElement(localName = "Image")
    public static class Image {

        @JacksonXmlProperty(localName = "MediaId")
        private String mediaId;
    }

    @Data
    @JacksonXmlRootElement(localName = "Voice")
    public static class Voice {

        @JacksonXmlProperty(localName = "MediaId")
        private String mediaId;
    }

    @Data
    @JacksonXmlRootElement(localName = "Video")
    public static class Video {

        @JacksonXmlProperty(localName = "MediaId")
        private String mediaId;

        @JacksonXmlProperty(localName = "Title")
        private String title;

        @JacksonXmlProperty(localName = "Description")
        private String description;
    }
}
